#pragma once
#include <jthread.h>
#include <dsound.h>
#include "MutexBuffer.h"

namespace ipsound {

class CaptureSound : public JThread
{
public:
	CaptureSound( MutexBuffer* buffer );
	void* Thread();
	~CaptureSound();
private:
	void InitWaveFormat();
	void GetDataFromSoundBuffer();
private:
	MutexBuffer* buffer;
	WAVEFORMATEX wfx;
	DSCBUFFERDESC SoundBufDesc;
	LPDIRECTSOUNDCAPTUREBUFFER8 soundBuf8;
	unsigned short channelsNum, bitsPerSample;
	unsigned long samplesPerSec, soundBufOffset;
};

}